import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConexaoUtil {
	
	private static ConexaoUtil conexaoUtil;
	
	public static ConexaoUtil getInstance() {
		if (conexaoUtil == null) {
			conexaoUtil = new ConexaoUtil();
		}
		return conexaoUtil;
	}
	
	public Connection getConnection() throws Exception {
		Class.forName("com.mysql.jdbc.Driver");
		String url = "";
		String user = "";
		String senha = "";
		try {
			url = Servidor.getInstance().URL;
			user = Servidor.getInstance().USER;
			senha = Servidor.getInstance().PASSWORD;
		} catch(Exception e) {
			throw e;
		}
		return DriverManager.getConnection(url, user, senha);
	}
}
